package controller

import (
	"strconv"

	"gitee.com/crack007/proxy/src/logserver/model"

	"gitee.com/crack007/proxy/src/logserver/service"
	"github.com/gin-gonic/gin"
)

var LogController = logController{}

type logController struct {
}

type LogListDto struct {
	List []*model.LogModel `json:"list"`
}

func (x logController) List(ctx *gin.Context) *LogListDto {
	v, _ := ctx.GetQuery("count")
	count, _ := strconv.Atoi(v)

	response := &LogListDto{
		List: service.LogService.ListLog(count),
	}

	return response
}
